package com.ojoin.trade.supplyloan_core.utils.catchdata;

import java.util.HashMap;  
import java.util.Map;

import com.ojoin.trade.common.Constants;
import com.ojoin.trade.common.utils.VerityCodeUtils;
import com.ojoin.trade.supplyloan_core.utils.catchdata.httpclient.HttpsClientUtil;
//对接口进行测试  
public class TestMain {  
    private String url = "https://gomeb2b.gome.com.cn:8443/cas/servlet/captcha.jpg";  
    private String charset = Constants.ENCODING;  
    private HttpsClientUtil httpClientUtil = null;  
      
    public TestMain(){  
        httpClientUtil = new HttpsClientUtil();  
    }  
      
    public void test(){  
        String httpOrgCreateTest = url + "httpOrg/create";  
        Map<String,String> createMap = new HashMap<String,String>();  
        createMap.put("authuser","*****");  
        createMap.put("authpass","*****");  
        createMap.put("orgkey","****");  
        createMap.put("orgname","****");  
        String httpOrgCreateTestRtn = httpClientUtil.doPost(httpOrgCreateTest,createMap,charset);  
        System.out.println("result:"+httpOrgCreateTestRtn);  
    }  
      
    public void testGet(){  
        String httpOrgCreateTest = url;  
        
        byte[] bytes  = httpClientUtil.doGetRetunByte(httpOrgCreateTest,charset);  
        
        VerityCodeUtils.saveIMG(bytes, "D:\\liaowuhen\\guomei.jpg");    
        
        
        System.out.println("result:"+bytes.length);  
    }  
    
       
    public static void main(String[] args){  
        TestMain main = new TestMain();  
        main.testGet();  
    }  
}  
